package NC500;

public class NC594 {
    public double solve (int[] a) {
        double res = 0;
        for(int i=0;i<a.length-3;i++){
            for(int j=i+1;j<a.length-2;j++){
                for(int k=j+1;k<a.length-1;k++){
                    for(int l=k+1;l<a.length;l++){
                        int a1=a[i],a2=a[j],a3=a[k],a4=a[l];
                        if(a1<a2+a3+a4&&a2<a1+a3+a4&&a3<a1+a2+a4&&a4<a1+a2+a3){
                            double z = (double)(a1+a2+a3+a4)/2;
                            res = Math.max(res,Math.sqrt((z-a1)*(z-a2)*(z-a3)*(z-a4)));
                        }
                    }
                }
            }
        }
        return res;
    }
}